package com.d3works.apps.supplychain.service;

import com.d3works.apps.account.db.Invoice;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Partner;
import com.d3works.apps.purchase.db.PurchaseOrder;
import com.d3works.apps.sale.db.SaleOrder;
import com.d3works.exception.D3worksException;

public interface IntercoService {

  /**
   * Given a purchase order, generate the sale order counterpart for the other company
   *
   * @param purchaseOrder
   * @return the generated sale order
   */
  SaleOrder generateIntercoSaleFromPurchase(PurchaseOrder purchaseOrder) throws D3worksException;

  /**
   * Given a sale order, generate the purchase order counterpart for the other company
   *
   * @param saleOrder
   * @return the generated purchase order
   */
  PurchaseOrder generateIntercoPurchaseFromSale(SaleOrder saleOrder) throws D3worksException;

  /**
   * Given an invoice, generate the invoice counterpart for the other company.
   *
   * @param invoice
   * @return the generated invoice
   * @throws D3worksException
   */
  Invoice generateIntercoInvoice(Invoice invoice) throws D3worksException;

  /**
   * Find the interco company from the partner
   *
   * @param partner
   */
  Company findIntercoCompany(Partner partner);
}
